package com.atguigu.chouxiang;

public class Rectangle extends Graphic{//矩形
    private double length;//长
    private double width;//宽

    public Rectangle() {
        super();
    }

    public Rectangle(double length, double width) {
        super();
        this.length = length;
        this.width = width;
    }
    public Rectangle(String name,double length, double width) {
        super(name);
        this.length = length;
        this.width = width;
    }

    public double getLength() {
        return length;
    }

    public void setLength(double length) {
        this.length = length;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    @Override
    public String toString() {
        return "长：" + length +
                "，宽：" + width +
                "，面积：" + area();
    }

    @Override
    public double area() {
        return length * width;
    }
}
